/*
** handle_incant_mnt.c for zaapy/serv in /home/Smaxo/Travail/zappy-2015-2014s-renard_g/serv-src
** 
** Made by maximilien addari
** Login   <addari_m@epitech.net>
** 
** Started on  Fri Jul 13 14:33:30 2012 maximilien addari
** Last update Sun Jul 15 20:02:58 2012 maximilien addari
*/

#include	"server.h"

static void	send_player(t_list *list, t_client *graph)
{
  t_client	*client;
  t_item	*tmp;

  tmp = list->head;
  while (tmp != NULL)
    {
      client = (struct s_client *)tmp->content;
      if (client->gamer != NULL)
	{
	  graph->send->concat(graph->send, "plv ");
	  graph->send->concat_value(graph->send, client->sock);
	  graph->send->concat(graph->send, " ");
	  graph->send->concat_value(graph->send, client->gamer->level);
	  graph->send->concat(graph->send, "\n");
	}
      tmp = tmp->next;
    }
}

char		handle_incant_mnt(t_game *game, t_list *list, t_event *event)
{
  (void)event;
  if (game->sleep == 0 || game->sleep > 10000)
    {
      send_player(list, game->graphic);
      cmd_monitor("mct", game->graphic, game);
      return (0);
    }
  return (1);
}
